home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / lib / calc / help / operator < prev    next >
Text File  |  1995-07-17  |  3KB  |  79 lines

  1. Operators
  2.  
  3.     The operators are similar to C, but the precedence of most of
  4.     the operators differs.  In addition, there are several additional
  5.     operators, and some C operators are missing.  The following list
  6.     gives the operators arranged in order of precedence, from the
  7.     least tightly binding to the most tightly binding.
  8.  
  9.  
  10.     ,    Comma operator.
  11.         For situations in which a comma is used for another purpose
  12.         (function arguments, array indexing, and the print statement),
  13.         parenthesis must be used around the comma operator.
  14.  
  15.     a?:b:c    Conditional value.
  16.         The test for 'a' is identical to an if test.
  17.  
  18.     =  +=  -=  *=  /=  %=  //=  &=  |=  <<=  >>=  ^=  **=
  19.         Assignments.
  20.  
  21.     ||    Conditional OR.
  22.         Unlike C, the result is the first non-zero expression or 0,
  23.         instead of just 0 or 1.
  24.  
  25.     &&    Conditional AND.
  26.         Unlike C, the result is the last expression or 0,
  27.         instead of just 0 or 1.
  28.  
  29.     ==  !=  <=  >=  <  >
  30.         Relations.
  31.  
  32.     +  -
  33.         Binary plus and minus.
  34.  
  35.     *  /  //  %
  36.         Multiply, divide. and modulo.
  37.         Please Note: The '/' operator is a fractional divide,
  38.         whereas the '//' is an integral divide.  Thus think of '/'
  39.         as division of real numbers, and think of '//' as division
  40.         of integers (e.g., 8 / 3 is 8/3 whereas 8 // 3 is 2).
  41.         The '%' is integral or fractional modulus (e.g., 11%4 is 3,
  42.         and 10%pi() is ~.575222).
  43.  
  44.     |    Logical OR.
  45.         The signs of numbers do not affect the bit value.
  46.  
  47.     &    Logical AND.
  48.         The signs of numbers do not affect the bit value.
  49.  
  50.     ^  **  <<  >>
  51.         Powers and shifts.
  52.         The '^' and '**' are both exponentiation (e.g., 2^3 is 8).
  53.         The signs of numbers do not affect the bit values of shifts.
  54.         These operators associate rightward (e.g., 1<<3^2 is 512).
  55.  
  56.     +  -  !
  57.         Unary operators.
  58.         The '!' is the logical NOT operator.  Be careful about
  59.         using this as the first character of a top level command,
  60.         since it is also used for executing shell commands.
  61.  
  62.     ++  --
  63.         Pre or post indexing.
  64.         These are applicable only to variables.
  65.  
  66.     [ ]  [[ ]]  .  ( )
  67.         Indexing, double-bracket indexing, element references,
  68.         and function calls.  Indexing can only be applied to matrices,
  69.         element references can only be applied to objects, but
  70.         double-bracket indexing can be applied to matrices, objects,
  71.         or lists.
  72.  
  73.     variables  constants  .  ( )
  74.         These are variable names and constants, the special '.' symbol,
  75.         or a parenthesized expression.  Variable names begin with a
  76.         letter, but then can contain letters, digits, or underscores.
  77.         Constants are numbers in various formats, or strings inside
  78.         either single or double quote marks.
  79.